<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:a="https://github.com/pylonide/pylon" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>MASTER CLIENT</title>
        <script src="../ppc.js"></script>
        <style type="text/css">
            #message_log {
                border: 1px solid silver;
                font-family: "Lucida Console", Sans Serif;
                padding: 8px;
                color: green;
                background: #333;
                height: 250px;
                width: 250px;
            }

            .loginform {
                width: 250px;
                border: 1px solid silver;
            }
        </style>
    </head>
    <body>
        <a:skin src="../skins.xml" media-path="../../../skins/platform/trunk/images/"
          image-path="../../../skins/platform/trunk/images/" icon-path="../icons/" />

        <a:appsettings debug="false" debug-teleport="true" name="remotetest" locking="optimistic"  />

        <!-- <a:xmpp id="myXMPP" url="http://chatslave4.hyves.org:5222/http-poll" roster-model="myRoster" -->
        <a:xmpp id="myXMPP"
            url               = "http://rdb2.localhost:5280/http-bind"
            host              = "localhost"
            model             = "myRoster"
            model-contents    = "roster|typing|chat"
            type              = "binding"
            resource          = "{'ppc_'.appendRandomNumber(5)}"
            onconnected       = "ppc.console.log('yay')"
            onconnectionerror = "ppc.console.log('boohoo:' + event.message)"
            onauthfailure     = "ppc.console.log('AUTHFAILURE:' + event.message)"
            onconnectionlost  = "ppc.console.log('connection lost!:' + event.message)"
            onreconnect       = "ppc.console.log('attempting to restore connection')" />

        <a:remote transport="myXMPP" id="rmtFs" />

        <a:model id="mdlFs" remote="rmtFs" src="filesystem.xml" />

        <a:tree model="mdlFs" width="70%" height="200">
            <a:bindings>
                <a:caption match="[@caption|@filename]" />
                <a:icon  match="[drive]"  value="drive.png" />
                <a:icon  match="[file]"   value="page_white.png" />
                <a:icon  match="[folder]" value="folder.png" />
                <a:empty match="[folder]" value="Drag a contact to this group." />
                <a:each  match="[drive|folder|file]" />
            </a:bindings> 
        </a:tree>

        <a:list model="myRoster" each="[user]" caption="[@node]@[@host]" icon="icoUsers.gif" width="200" height="100" />

        <!--a:list id="lstPersons" model="mdlFs" each="[file]" caption="[@caption|@filename]" icon="icoUsers.gif" width="200" height="100" />

        <a:button onclick="lstPersons.rename(lstPersons.selected, 'test' + Math.round(Math.random()*100));">Rename</a:button>

        <a:button onclick="ppc.xmldb.setAttribute(lstPersons.selected, 'id', 'test' + Math.round(Math.random()*100));">Change Attr</a:button-->
        <!--a:button onclick="lstPersons.add('&lt;person&gt;new person&lt;/person&gt;')">Add</a:button>

        <a:slider value="[folder[1]/@test]" realtime="false" model="mdlFs" /-->

        <br />
        <a:textbox id="username" value="mike" />
        <br/><br />
        <a:textbox type="password" id="password" value="mike1324" />
        <br/><br/>
        <button onclick="myXMPP.connect(username.value, password.value)">Login</button>
        <button onclick="myXMPP.disconnect()">Disconnect</button>
        <br/>
        <br/>
        <a:textarea id="txtAnyXml" width="70%" height="120" resizable="true"><![CDATA[
            <message to='test@rdb.localhost' />
        ]]></a:textarea>
        <a:button caption="Send" id="btnSend" onclick="myXMPP.sendXml({message: txtAnyXml.value, callback: function(data) {alert(data);}})" />
    </body>
</html>